package com.baogu.factoryjob.service.impl;

import com.baogu.factoryjob.mapper.BaoGuDataMapper;
import com.baogu.factoryjob.service.BaoGuDataService;
import com.baogu.model.job.*;
import com.baogu.model.job.where.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BaoGuDataServiceImple implements BaoGuDataService {

    @Autowired
    BaoGuDataMapper baoGuDataMapper;

    @Override
    public String isEffective(String id) {
        return baoGuDataMapper.isEffective(id);
    }

    @Override
    public Controllersensor getControllersensorByIdAndPort(ControllersensorWhere where) {
        return baoGuDataMapper.getControllersensorByIdAndPort(where);
    }

    @Override
    public Integer setControllerStatus(ControllerStatus controllerStatus) {
        return baoGuDataMapper.updateControllerStatus(controllerStatus);
    }

    @Override
    public CollectionPointCropRel getCollectionPointCropRel(CollectionPointCropRelWhere where) {
        return baoGuDataMapper.getCollectionPointCropRel(where);
    }

    @Override
    public List<CropUploadDataPeriodRecord> getCropUploadDataPeriodRecord(CropUploadDataPeriodRecordWhere where) {
        return baoGuDataMapper.getCropUploadDataPeriodRecord(where);
    }

    @Override
    public LiftCycleEntity getLiftCycleEntity(LiftCycleEntityWhere where) {
        return baoGuDataMapper.getLiftCycleEntity(where);
    }

    @Override
    public LiftWarnEntity getLiftWarnEntity(LiftWarnEntityWhere where) {
        return baoGuDataMapper.getLiftWarnEntity(where);
    }

    @Override
    public void saveMessageNotice(MessageNoticeEntity messageNoticeEntity) {
        baoGuDataMapper.saveMessageNotice(messageNoticeEntity);
    }

    @Override
    public void saveErrorJob(ErrorJobWhere errorJobWhere) {
        try {
            baoGuDataMapper.saveErrorJob(errorJobWhere);
        }catch (Exception ex){
            ex.printStackTrace();
        }
    }

    @Override
    public List<ErrorJob> errorJobList(ErrorJobWhere errorJobWhere) {
        return baoGuDataMapper.errorJobList(errorJobWhere);
    }

    @Override
    public Integer updateErrorJobState(ErrorJobWhere errorJobWhere) {
        return baoGuDataMapper.updateErrorJobState(errorJobWhere);
    }

    @Override
    public ReUploadData getReUploadData(ReUploadDataWhere where) {
        return baoGuDataMapper.getReUploadData(where);
    }

    @Override
    public void updateReUploadData(ReUploadDataWhere where) {
        baoGuDataMapper.updateReUploadData(where);
    }
}
